
#ifndef __SECURITY_TOKEN_H
#define __SECURITY_TOKEN_H

#include <libssh2.h>
#include "../iface/LibSSH2Interface.h"

/** An abstract class representing an SSH authentication. */
class SecurityToken
{
   public:
      enum sshauthtype { SSH_AUTH_TYPE_INTERACTIVE   = 0,
                         SSH_AUTH_TYPE_PASSWORD      = 1,
                         SSH_AUTH_TYPE_KEY           = 2 };
      virtual ~SecurityToken() {}
      virtual int authenticateSSHSession(LIBSSH2_SESSION *tsession, const char *username) = 0;
      virtual sshauthtype getAuthenticationType() = 0;
      virtual int wasTried() = 0;
      void addUnsuccessfulAuthenticationMarking() { tried = 1; }
      void removeUnsuccessfulAuthenticationMarking() { tried = 0; }
   protected:
      /** Was this authentication tried and unsuccessful? */
      int tried;
};

#endif
